package com.gzcstec.swagger.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/demo")
@Api("demo")
public class SwaggerControllerDemo {

    /*方法api描述*/
    @ApiOperation("hello world")
    /*方法的参数要求*/
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name" , defaultValue = "yien" , paramType = "path"),
            @ApiImplicitParam(name = "msg" , defaultValue = "world" , paramType = "query"),
    })
    @GetMapping("/{name}")
    public String hello(@RequestParam(value = "msg",required = false) String msg , @PathVariable("name") String name) {
        return name+":hello "+msg;
    }
}
